package com.atguigu.day28.work;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Work5 {

    public static void main(String[] args) {
        ArrayList<Student> arrayList = new ArrayList<>();
        arrayList.add(new Student("谢霆锋", 85));
        arrayList.add(new Student("章子怡", 65));
        arrayList.add(new Student("刘亦菲", 77));
        arrayList.add(new Student("黄晓明", 33));
        arrayList.add(new Student("岑小村", 91));

        Collections.sort(arrayList, new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return o1.getScore()-o2.getScore();
            }
        });
        Collections.sort(arrayList, Comparator.comparingInt(Student::getScore));

        Collections.sort(arrayList,(o1,o2)->o1.getScore()-o2.getScore());
    }
}
